package collection.list;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Test3 {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>(List.of(1, 2, 3, 4, 4, 5, 6, 7));
        int i = list.lastIndexOf(4);
        System.out.println(i);

        List<Integer> integers1 = list.subList(0, 4);
        System.out.println(integers1);

        list.addAll(3, List.of(4, 6, 4, 5, 2));
        System.out.println(list);

        Integer[] integers = list.toArray(new Integer[0]);
        System.out.println(Arrays.toString(integers));

        Integer[] integers2 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
        Integer[] integers3 = list.toArray(integers2);
        System.out.println(Arrays.toString(integers3));
    }
}
